package br.com.r1.jpastandalone.models;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import br.com.r1.jpastandalone.enums.DocumentType;

@Entity
@Table(name="document")
public class Document implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id @GeneratedValue
	private Long id;
	private String number;
	
	@Temporal(TemporalType.DATE)
	private Calendar emissao;
	
	@Enumerated(EnumType.STRING)
	private DocumentType tipo;
	
	@ManyToOne
	@JoinColumn(name="cli_id")
	private Client client;
		
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public Calendar getEmissao() {
		return emissao;
	}

	public void setEmissao(Calendar emissao) {
		this.emissao = emissao;
	}

	public DocumentType getTipo() {
		return tipo;
	}

	public void setTipo(DocumentType tipo) {
		this.tipo = tipo;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	@Override
	public String toString() {
		return "Document [id=" + id + ", number=" + number + ", tipo=" + tipo
				+ ", emissao=" + emissao + "]";
	}
}